/*
 * @File:
 * @Author: sjk
 * @Date: 2022-03-06 10:12:16
 * @LastEditTime 2022-04-09 21:09:43
 * @Brief:
 * @Note:自定义电机输出
 */
#ifndef __MOTOR_H
#define __MOTOR_H
#include "Global_define.h"

// PWM和GPIO配合
#define C6G5 1
#define C7G6 2 //使用
#define C8G7 3 //使用
#define C9G8 4

//确定端口，前进正负
#define Motor(left, right) \
    Motor_left(left);      \
    Motor_right(right)
#if defined UseLeaningboard
    #define Motor_left(x) Motor_Single(C6G5, -x)
    #define Motor_right(x) Motor_Single(C7G6, x)
#elif defined UseDiyboard
    #define Motor_left(x) Motor_Single(C8G7, -x)
    #define Motor_right(x) Motor_Single(C7G6, x)
#endif

void Motor_myInit(u16 freq);
void Motor_Single(u8 MotorIO, int16_t duty);
void Test_myMotor(void);
void Motor_test_vTen(void);

//移植
#define Motor_on(dip, dir) Motor(dip - dir, dip + dir)

#endif